Dynamics of a quantum reference frame