Resonance line transfer and transport of excited atoms—I. Basic relations and limiting cases