I don't understand what I missed that I got wrong variance:
Theorem: $\displaystyle Var(aU + b) = a^2 Var(U)$.
In your case $\displaystyle a = \cos t$ and $\displaystyle b = 0$.
Alternatively:
$\displaystyle E(X) = \int_a^b \frac{u \cos t}{b-a} \, du = \frac{a + b}{2} \, \cos t$.
$\displaystyle E(X^2) = \int_a^b \frac{u^2 \cos^2 t}{b-a} \, du = \frac{a^2 + ab + b^2}{3} \, \cos^2 t$.
Note: $\displaystyle \frac{b^3 - a^3}{b-a} = \frac{(b-a)(b^2 + ab + a^2)}{b-a} = b^2 + ab + b^2$.
$\displaystyle Var(X) = E(X^2) - [E(X)]^2 = \frac{a^2 + ab + b^2}{3} \, \cos^2 t - \frac{(a + b)^2}{4} \, \cos^2 t = \frac{(b-a)^2}{12} \, \cos^2 t$.