Resonance shifts of counterpropagating whispering-gallery modes: degenerate perturbation theory and application to resonator sensors with axial symmetry