Theory of plasma heating by magnetosonic cavity mode absorption