Systematic corrections to the rotating-wave approximation and quantum chaos