Find width of the biggest rectangle in a sector Is it possible to find the width and starting coordinates of the biggest horizontal rectangle of a fixed height inscribed in a given sector with any angle?

This is actually to do with computer programming. I am creating a pie chart and the rectangle is supposed to hold a label relating to the information represented by the sector. 
I can measure the width of the text(of constant height) that I want to place within the rectangle. If I can find the width of the widest horizontally placed rectangle of a given height, I can decide if the label would fit completely within the sector. If not, it would need to be moved outside of the circle.
The sector has a variable angle as in a pie chart different sectors have different angles.
I am not too good at geometry, so I thought of asking here. Please let me know if any other information is required.
 A: I suppose at least 3 vertices of the rectangle must be on the radii and circular arc.
"Horizontal" has no meaning in this context of bounded area maximization. The procedure should be valid for arbitrary rotation/ translations of the sector.
When sector is acute angled, angle bisector serves as basis giving max area of a sector/pie as shown below:
$(s,c,t)$ short hand for $(\sin\theta,  \cos\theta,\tan\theta). $
Wlog, one side can be taken  along x-axis. Coordinates of required point $(c,s,\theta)$ and for sector endpoint $(x_1,y_1,\alpha)$
Equations of end radius and intermediate radius are
$$ y= s_1/c_1,\quad y=s\,$$ cutting at
$$ s=t_1$$
$$Area= s(c- s /t_1)$$
To find max area differentiate with resp to argument $\theta$.  By Chain Rule
$$ \dfrac{s}{c-s/t_1}=\dfrac{c}{s+c/t}$$
Cross multiply and simplify
$$ \tan \alpha = \tan 2 \theta ,\quad\boxed{\theta= \alpha/2}$$
So we need to bisect the central sector angle to arrive at lead points to further draw as you indicated towards the rectangle.

To draw pie of maximum rectangular area of an obtuse central angle bisect the sectors and bisect the half sector yet again. Join the quatrasector points and their perpendiculars as shown in the required maximum rectangle $PQRS$.
