Beam dynamics in transverse deflecting rf structures