My understanding is that the energy of a photon depends your your reference frame because the energy of a photon depends on its frequency and its frequency may get Doppler shifted. Now, I am trying to reconcile this with the answer I get when taking the scalar product of the 4-momentum of a massive particle with that of a massless particle. Say, $$ p^\mu = \left(E_p, \vec{p}\right) $$ is the 4-momentum of the massive particle and $$ q^\mu = \left(E_q,\vec{q}\right) $$ is the 4-momentum of the massless particle. Then, their scalar product is $$ p^\mu q_\mu = E_pE_q - \vec{p}\cdot\vec{q} $$ which, in the rest frame of the massive particle is $$ p^\mu q_\mu = m_pE_q. $$ This must be Lorentz invariant since it is the product of two 4-vectors but my understanding is that $E_q$ depends on your frame of reference while $m_p$ does not. This is my confusion.
The only way I can think to reconcile this is that $E_q$ is only the energy of the photon in the rest frame of the massive particle but I'm not sure if this is correct. It seems like between the last two equations, $E_q$ has changed its meaning from a frame dependent quantity to a frame-independent quantity which I find bizarre. Should I write the last expression as $p^\mu q_\mu = m_pE'_q$ where $E'_q$ is now a frame-independent quantity?