Theory of high-resolution mass spectrometry achieved via resonance ejection in the quadrupole ion trap