Calculating Edge points of a rectangle in 2D I'm building a computer game and I got stuck during a math calculation:

The game is a 2D game and is based on a Cartesian coordinate system.
I know the coordinates of E and F. From there I know the angle of EF (Also the angle of AB and CD). I also know the length of AB and the length of CD. 
I'm having a hard time finding the solution of calculationg A, B, C and D.
Any help would be appreciated
Thanks!
 A: You could find a vector which is orthogonal to $EF$ and has length $1$, i.e. an orthonormal vector to $EF$. You can obtain this vector by setting
\begin{equation}
v=E-F=(x_E-x_F,\quad y_E-y_F):=(v_1,v_2)
\end{equation}
and then the vector we want is
\begin{equation}
u=\frac{1}{\|v\|}(-v_2,v_1)
\end{equation}
and then you get the other points:
\begin{equation}
A=E+\frac{\overline{AB}}{2}u,\qquad B=E-\frac{\overline{AB}}{2}u
\end{equation}
and
\begin{equation}
C=F+\frac{\overline{CD}}{2}u,\qquad D=F-\frac{\overline{CD}}{2}u
\end{equation}
A: If you don't know how to do the original calculation, then you probably won't understand some parts of the other answers, either. Also, if you want your code to run fast, you should avoid trig functions like sin  and cos.
So, here is some simple code that should be easy to understand, and avoids trig functions:
' Get vector U from E to F 
Ux = F.x - E.x
Uy = F.y - E.y

' Unitize the vector U
d = 1/sqrt(Ux*Ux + Uy*Uy)
Ux = d*Ux
Uy = d*Uy

' Rotate U by 90 degrees to get V
Vx = -Uy
Vy =  Ux

' You said you know the width w between A and B
w = 0.5*Length(AB)

' Calculate A, B, C, D
Rx = w*Vx      ;    Ry = w*Vy 
Ax = Ex + Rx   ;    Ay = Ey + Ry
Bx = Ex - Rx   ;    By = Ey - Ry
Cx = Fx - Rx   ;    Cy = Fy - Ry
Dx = Fx + Rx   ;    Dy = Fy + Ry

A: Although I am not sure what you mean by "Angle of a line", I would I assume you meant its slope (the angle from the $x$-axis to the line, going counterclockwise).
$x_A = x_E + 0.5 AB \cos(\theta_{AB})$
$y_A = x_E + 0.5 AB \sin(\theta_{AB})$
$x_B = x_E - 0.5 AB \cos(\theta_{AB})$
$y_A = x_E - 0.5 AB \sin(\theta_{AB})$
Similarly, you can get the coordinates of $C$ and $D$.
A: Let E be $(0, 0)$:
F = $(EF\cos\theta, EF\sin\theta)$
A = $(-\frac{AB}{2}\cos\theta, \frac{AB}{2}\sin\theta)$
B = $(\frac{AB}{2}\cos\theta, -\frac{AB}{2}\sin\theta)$
C = $(EF\cos\theta + \frac{CD}{2}\cos\theta, EF\sin\theta - \frac{CD}{2}\cos\theta)$
D = $(EF\cos\theta - \frac{CD}{2}\cos\theta, EF\sin\theta + \frac{CD}{2}\cos\theta)$
