Two-dimensional oscillatory lid-driven cavity flow of a rarefied gas at arbitrary oscillation frequency is investigated using the linearized Boltzmann equation. An analytical solution at high oscillation frequencies is obtained, and detailed numerical results for a wide range of gas rarefaction are presented. The influence of both the aspect ratio of the cavity and the oscillating frequency on the damping force exerted on the moving lid is studied. Surprisingly, it is found that, over a certain frequency range, the damping is smaller than that in an oscillatory Couette flow. This reduction in damping is due to the anti-resonance of the rarefied gas. A scaling law between the anti-resonant frequency and the aspect ratio is established, which would enable the control of the damping through choosing an appropriate cavity geometry.