Atmospheric tides and the rotation of Venus I. Tidal theory and the balance of torques