Elegant way to evaluate $\int_0^\pi\frac{\sin\left(M+\frac{1}{2}\right)\theta\;\sin\left(N+\frac{1}{2}\right)\theta}{\sin^2(\theta/2)}d\theta$? Solve in terms of $M, N$
$$I(M. N) = \int_0^\pi\frac{\sin\left[\left(M + \frac{1}{2}\right)\theta\right]\sin\left[\left(N + \frac{1}{2}\right)\theta\right]}{\sin^2\left(\frac{\theta}{2}\right)}d\theta$$
where $M, N$ are non-negative integers.
I've tried solving it by using trigonometric identities and brute force, but it gets extremely annoying. Is there a simpler way?

Hint
$${\displaystyle {\begin{aligned}1+2\sum _{n=1}^{N}\cos(n\theta )&={\frac {\sin \left(\left(N+{\frac {1}{2}}\right)\theta \right)}{\sin \left({\frac {\theta }{2}}\right)}}\end{aligned}}}$$
and use the following fact
$$\int_{0}^{\pi}\cos(n \theta)\cos(m \theta)d \theta=0$$
when $$m \ne n$$
