<span>First, I'm going to categorize the portions of the rectangle. The red portions are grid squares that are completely enclosed by the rectangle, the green portions are the corners and finally the blue regions are the edges.
</span>
4x-t-4 is the final answer.
Using cos addition formula:
use x for theta
cos(x+π/6)=cosx*cos(π/6)-sinx*sin(π/6)
sinx=1/4
cosx=√15/4
cos(π/6)=√3/2
sin(π/6)=1/2
cos(x+π/6)=(√15/4*√3/2)-(1/4*1/2)
cos(x+π/6)=(√45/8)-(1/8 )
cos(x+π/6)=(√45-1)/8)