Adiabatic demagnetization in the doubly rotating frame