Spin selection rule for {\it S} level transitions in atomic rubidium under paraxial and nonparaxial two-photon excitation