Trapped-ion motion in ion cyclotron resonance spectroscopy