Theory of charge transfer for desorption of ions from surfaces