Remove surrounding zeroes of a 2d array This is a 2-dimensional version of this question.

Given a non-empty 2-dimensional array/matrix containing only non-negative integers:

$$ \begin{bmatrix}
{\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} \\
{\color{Red}0} &amp; {\color{Red}0} &amp; 0 &amp; 1 &amp; 0 \\
{\color{Red}0} &amp; {\color{Red}0} &amp; 0 &amp; 0 &amp; 1 \\
{\color{Red}0} &amp; {\color{Red}0} &amp; 1 &amp; 1 &amp; 1 \\
{\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0}
\end{bmatrix} $$

Output the array with surrounding zeroes removed, i.e. the largest contiguous subarray without surrounding zeroes:

$$ \begin{bmatrix}
0 &amp; 1 &amp; 0 \\
0 &amp; 0 &amp; 1 \\
1 &amp; 1 &amp; 1
\end{bmatrix} $$

Examples:

$$ \begin{bmatrix}
{\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} \\
{\color{Red}0} &amp; {\color{Red}0} &amp; 0 &amp; 1 &amp; 0 \\
{\color{Red}0} &amp; {\color{Red}0} &amp; 0 &amp; 0 &amp; 1 \\
{\color{Red}0} &amp; {\color{Red}0} &amp; 1 &amp; 1 &amp; 1 \\
{\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0}
\end{bmatrix} 
\mapsto
\begin{bmatrix}
0 &amp; 1 &amp; 0 \\
0 &amp; 0 &amp; 1 \\
1 &amp; 1 &amp; 1
\end{bmatrix}
$$

Input:
[[0, 0, 0, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [0, 0, 0, 0, 0]]

Output:
[[0, 1, 0], [0, 0, 1], [1, 1, 1]]


$$ \begin{bmatrix}
{\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} \\
{\color{Red}0} &amp; 0 &amp; 0 &amp; 3 \\
{\color{Red}0} &amp; 0 &amp; 0 &amp; 0 \\
{\color{Red}0} &amp; 5 &amp; 0 &amp; 0 \\
{\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0}
\end{bmatrix} 
\mapsto
\begin{bmatrix}
0 &amp; 0 &amp; 3 \\
0 &amp; 0 &amp; 0 \\
5 &amp; 0 &amp; 0
\end{bmatrix}
$$

Input:
[[0, 0, 0, 0], [0, 0, 0, 3], [0, 0, 0, 0], [0, 5, 0, 0], [0, 0, 0, 0]]

Output:
[[0, 0, 3], [0, 0, 0], [5, 0, 0]]


$$ \begin{bmatrix}
1 &amp; 2 &amp; 3 \\
4 &amp; 5 &amp; 6 \\
7 &amp; 8 &amp; 9
\end{bmatrix}
\mapsto
\begin{bmatrix}
1 &amp; 2 &amp; 3 \\
4 &amp; 5 &amp; 6 \\
7 &amp; 8 &amp; 9
\end{bmatrix}
$$

Input:
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]

Output:
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]


$$ \begin{bmatrix}
{\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} \\
{\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} \\
{\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0}
\end{bmatrix}
\mapsto
\begin{bmatrix}
\end{bmatrix}
$$

Input:
[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]

Output:
[]


$$ \begin{bmatrix}
{\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} \\
1 &amp; 1 &amp; 1 &amp; 1 \\
{\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0} &amp; {\color{Red}0}
\end{bmatrix}
\mapsto
\begin{bmatrix}
1 &amp; 1 &amp; 1 &amp; 1
\end{bmatrix}
$$

Input:
[[0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0]]

Output:
[[1, 1, 1, 1]]


$$ \begin{bmatrix}
{\color{Red}0} &amp; 1 &amp; {\color{Red}0} &amp; {\color{Red}0} \\
{\color{Red}0} &amp; 1 &amp; {\color{Red}0} &amp; {\color{Red}0} \\
{\color{Red}0} &amp; 1 &amp; {\color{Red}0} &amp; {\color{Red}0}
\end{bmatrix}
\mapsto
\begin{bmatrix}
1 \\
1 \\
1
\end{bmatrix}
$$

Input:
[[0, 1, 0, 0], [0, 1, 0, 0], [0, 1, 0, 0]]

Output:
[[1], [1], [1]]


$$ \begin{bmatrix}
1 &amp; 1 &amp; 1 &amp; 1 \\
1 &amp; 2 &amp; 3 &amp; 1 \\
1 &amp; 1 &amp; 1 &amp; 1
\end{bmatrix}
\mapsto
\begin{bmatrix}
1 &amp; 1 &amp; 1 &amp; 1 \\
1 &amp; 2 &amp; 3 &amp; 1 \\
1 &amp; 1 &amp; 1 &amp; 1
\end{bmatrix}
$$

Input:
[[1, 1, 1, 1], [1, 2, 3, 1], [1, 1, 1, 1]]

Output:
[[1, 1, 1, 1], [1, 2, 3, 1], [1, 1, 1, 1]]
Wolfram Language (Mathematica), 42 bytes
#&amp;@@CellularAutomaton[{,{},0{,}},{#,0},0]&amp;

Try it online!
Cellular automata are indeed the answer to life, the universe, and everything.1
How?
CellularAutomaton accepts an input array and an optional background value. Thus, {#,0} specifies that a cellular automaton rule should be applied to the input, assuming a background of 0s.
A neat thing here is that CellularAutomaton crops the output so that no border of background cells is present (because otherwise the output lies on an infinite plane).
The code applies the rule {Null, {}, {0, 0}} -- applying the head Null to the 0-radius neighbor of each cell (i.e. only the center: the cell itself) -- exactly 0 times. The result of this is the original input, but with background removed (i.e. cropping out surrounding 0s).

1. See the bytecount of my answer? ;)