Let \$A\$ be a square matrix that is at least \$2 \times 2\$ where each element is an integer. \$A^2 = A \times A\$ will then have the same dimensions as \$A\$, and will have integer elements. For example, let
$$A = \left[ \begin{matrix} -3 & 2 \\ 0 & -1 \end{matrix} \right]$$
Therefore,
$$\begin{align} A^2 & = \left[ \begin{matrix} -3 & 2 \\ 0 & -1 \end{matrix} \right]^2 \\ & = \left[ \begin{matrix} -3 & 2 \\ 0 & -1 \end{matrix} \right] \times \left[ \begin{matrix} -3 & 2 \\ 0 & -1 \end{matrix} \right] \\ & = \left[ \begin{matrix} -3 \times -3 + 2 \times 0 & -3 \times 2 + 2 \times -1 \\ 0 \times -3 + -1 \times 0 & 0 \times 2 + -1 \times -1 \\ \end{matrix} \right] \\ & = \left[ \begin{matrix} 9 & -8 \\ 0 & 1 \end{matrix} \right] \end{align}$$
Given an \$n \times n\$ matrix \$B\$ consisting only of integer elements, output any \$n \times n\$ integer matrix \$A\$ such that \$A^2 = B\$. You may optionally take \$n\$ as an input, and you may assume that you'll only have to handle matrices for which there exists such an \$A\$.
You may take input and output in any convenient format and method. This is code-golf so the shortest code in bytes wins.
Test cases
The outputs given below are not necessarily the only valid outputs
[[8, 96], [-84, -40]] -> [[-8, -8], [7, -4]]
[[18, 63], [14, 67]] -> [[0, 9], [2, 7]]
[[9, 0], [-10, 25]] -> [[3, 0], [5, -5]]
[[25, -58, 57], [0, 7, -4], [0, -24, 31]] -> [[5, -7, 5], [0, -1, -1], [0, -6, 5]]
[[12, -33, 42], [16, 19, 20], [-90, 18, 63]] -> [[6, -3, 3], [2, 5, 1], [-6, 0, 9]]
[[33, -80, 86], [72, 57, -13], [-88, 40, 44]] -> [[-8, 7, -3], [-1, 0, 8], [8, 8, -2]]
[[88, 8, -72, 65], [-12, 45, 17, 33], [-27, 21, 36, 31], [5, 40, -53, 119]] -> [[-5, -4, 3, -9], [-6, 0, 0, 7], [-5, 5, -4, 7], [-6, 3, 5, -3]]
[[45, 39, -25, -17, 61], [29, 69, -15, 2, 45], [42, 51, 7, -28, 67], [27, 65, -25, 7, 25], [-66, -61, 9, 63, 1]] -> [[9, 7, -3, -9, 3], [3, -3, 5, -8, -2], [5, 3, 5, -9, 2], [3, -2, 2, -8, -4], [-5, -4, 0, 7, 6]]
[[150, -73, -37, -40, -43, 119], [-62, 191, 95, -87, -10, -88], [-31, -32, -64, 137, 82, -54], [22, -81, 32, 24, 46, -149], [-5, -16, -6, 42, 63, -23], [106, -160, -115, 25, 20, -5]] -> [[8, -8, -3, 5, 6, 3], [-7, 6, 8, 5, 6, -4], [5, 1, -1, -7, 1, -9], [0, 9, 6, -8, -2, 9], [4, 3, 2, -1, -3, -2], [7, -7, 2, -5, -4, 1]]
[[146, -37, -60, -38, 30, -8], [71, -42, -33, -26, -15, -55], [-39, -74, 2, -46, -19, 31], [42, -136, -46, 19, -41, -3], [61, 23, 12, -8, 37, -59], [-73, -13, 88, 90, -71, -11]] -> [[4, 7, -2, -4, 4, -1], [8, -1, -3, -6, 2, 4], [-9, 5, -2, 6, 1, 3], [-7, 6, 1, -5, 4, 3], [5, -8, -8, 2, 3, -4], [-8, -8, -1, -4, -6, -2]]