I have a polygon with all coordinates known. I want to draw a rectangle around it making $(x_1,y_1)$ and $(x_2,y_2)$ as it's base. How can I get new coordinates forming rectangle around polygon?

(x1,y1) = (8.375, 127.5258)
(x2,y2) = (26.1326, 127.5258)
(x3,y3) = (26.375, 130.5258)
(x4,y4) = (23.6995, 141.2277)
(x5,y5) = (8.375, 137.3966)


I will denote $v_{ij}=\begin{bmatrix} x_j \\ y_j \end{bmatrix} - \begin{bmatrix} x_i \\ y_i \end{bmatrix}$, that is the vector from $i$-point to $j$-point.
$$ \begin{bmatrix} x_2 \\ y_2 \end{bmatrix} +\frac{v_{12} \cdot v_{23}}{\Vert{v_{12}}\Vert} \Big(\frac{v_{12}}{{\Vert{v_{12}}\Vert}}\Big) = \text{ coordinates of lower-right vertex}. $$
$$ \begin{bmatrix} x_1 \\ y_1 \end{bmatrix} +\frac{v_{12} \cdot v_{15}}{\Vert{v_{12}}\Vert} \Big(\frac{v_{12}}{{\Vert{v_{12}}\Vert}}\Big)= \text{ coordinates of lower-left vertex}. $$
$$ \begin{bmatrix} x_4 \\ y_4 \end{bmatrix} +\frac{v_{12} \cdot v_{43}}{\Vert{v_{12}}\Vert}\Big(\frac{v_{12}}{{\Vert{v_{12}}\Vert}}\Big) = \text{ coordinates of upper-right vertex}. $$
$$ \begin{bmatrix} x_4 \\ y_4 \end{bmatrix} +\frac{v_{12} \cdot v_{45}}{\Vert{v_{12}}\Vert} \Big(\frac{v_{12}}{{\Vert{v_{12}}\Vert}}\Big)= \text{ coordinates of upper-left vertex}. $$
Fractions like $\frac{v_{12} \cdot v_{45}}{\Vert{v_{12}}\Vert}$ are the projections of sides of the polygon onto the direction of the base, while $\Big(\frac{v_{12}}{{\Vert{v_{12}}\Vert}}\Big)$ is a unit vector of the base direction.