Rotate the query by \(m\theta\) and the key by \(n\theta\). The score is the cosine of the angle between the hands, and that angle only knows \(n - m\).