p^2x - 2q^2y - 2pqx + pqy

rearrange a bit and you have

px(p-2q) - qy(p-2q)
(px-qy)(p-2q)