A gauge-invariant formulation of interband and intraband currents in solids