Calculating the points of a annular sector type shape. The problem involves a circle inside a square sharing a common center point. The circle is always smaller than the square so that their edges never intersect. Then an annular sector (see cyan shape in Figure01) is sliced out in the area between the circle and square that consists of an indented arc (circle's edge) and two points (square's edge). The two points are what I am after amongst other things.
One important thing to bare in mind is that whatever angles are used to obtain the sector must also be offset by a certain amount as will become clear when you consider the magenta lines on Figure01 which represent the StartOffset and EndOffset respectively.
Figure01

It is for a computer graphics function in Visual-Basic.NET so the user will input certain given values and from this the annular sector must be created.
Given:


*

*StartAngle: Any valid degree between 0 and 360 (Left red line in Figure01).

*SweepAngle: Any valid degree between 0 and 360 (Right red line in Figure01).

*StartOffset: An amount of pixels to add to the StartAngle (Left magenta line in Figure01).

*EndOffset: An amount of pixels to subtract from the SweepAngle (Right magenta line in Figure01).

*CircleRadius: The radius of the circle (Indicated with yellow in Figure01).

*SquareSize: The size of the square in pixels (Indicated with green in Figure01).


From these values the arc will be calculated on the circle's edge as follows. I merely need to give a starting degree and an amount of degrees to sweep so I calculate it as follows:


*

*StartOffsetAngle = Asin(StartOffset / CircleRadius) * (180.0R / PI)

*EndOffsetAngle = Asin(EndOffset / CircleRadius) * (180.0R / PI)

*StartValue = StartAngle + StartOffsetAngle

*SweepValue = SweepAngle - (StartOffsetAngle + EndOffsetAngle)


Then the two points that extends the arc to the square must be added and here is where the problems start:
First of all the radius to the StartAngle needs to be calculated for the square, but to do this the StartOffset needs to be added. To convert the StartOffset to degrees using Asin() the radius must be known. Is there a way to calculate these values and if so how?
The same problem goes for the other point, since the EndOffset needs to be subtracted.
Obviously when a corner in the square is overlapped there will be three points, but this is not my current problem, and should be easy to add.
Thanks
drifter
EDIT 1: I edited Figure01 based on the comments below. Hopefully it is clear now that the angle between the red lines and the angle between the magenta lines cannot possibly be the same. In the previous figure I tried to show the offset as a parallel chord, but it seems that was a bit confusing.
EDIT 2:
Here is another image and some more explanation.

Basically the annular sector marked C is drawn by another function that uses two arcs. I can draw as many annular sectors outside of each other as I need without the offset between them sideways gradually increasing because the Asin(*Offset / *CircleRadius) is calculated for each arc. Now A and B has an *Offset indicated by D. This was drawn by hand, but when the function does it the offset grows gradually as it moves away from the center point (The black area gets wider). This is because I use a right angled triangle to get the radius to the outer points of A and B so that I can use Asin(*Offset / CalculatedSquareRadius) to calculate the offset angle with the correct radius. This seems to put me in an infinite loop (I Can't get the correct radius to the square without the proper angle that includes the offset and I can't get the correct angle without the radius). I also need to be able to calculate before I run the function how much the SweepAngle should be in degrees if I want it to represent a travel of 150 pixels on the square's edge.
 A: Here's how you can compute it. Suppose you have a red ray $R$ from the center that hits the upper edge of the square at a point $P$, and suppose this ray deviates from the vertical ray upward from the center by an (absolute) angle $t$ (assume $t$ is sufficiently small that $P$ is away from the corners).
Then a magenta ray $R'$ parallel to $R$ but at a distance $\epsilon$ away from $R$ (you are using $\epsilon = 2.5$) will meet the upper edge of the square at at distance $d = \epsilon/\cos t$ away from $P$. This is true whether $R'$ is on the left or the right of $R$.
On the bottom, you would measure the deviation from a vertical ray downward from the center.
On the sides, you would measure the deviation from a horizontal ray leftward/rightward from the center.
Near the corners, it's harder. You'll have to extend the edges of the square and determine how much of the distance $d$ is actually on the edge of the square.
Note that the (absolute) deviation $t$ is no more than $45^{\circ}$, so the cosine is always positive.
So given this procedure, you can perform the analysis on both of the red rays in question. You have the distance, just be sure to add/subtract it correctly according to whether you are on the left/right side of the sector. I presume you know how to find the "ending" angle, given the "starting" angle (like $225^{\circ}$) and the distance $150$.
In your drawing, the magenta ray on the left side of the sector hits the upper edge at a distance of $$\frac{2.5}{\cos 45^{\circ}} \approx 3.536$$ from the upper left corner. That's point $D$ in your drawing.
EDIT: Now you have changed the drawing, which completely invalidates the geometry you insisted on earlier. The red rays are no longer parallel to the magenta rays. That renders this solution invalid. This was a lot of tedious explanation for nothing. Boo. :(
