Reducing collective quantum state rotation errors with reversible dephasing