Since $A$ is nonsingular, $A_{11}$ and $A_{22}$ have to be nonsingular. (You can convince yourself of this fact by say, reducing $A_{11}$ and $A_{22}$ to RREF. If either is singular, then its RREF has to have zero rows and zero columns. This means, $A$ has to have zero rows or zero columns, contradicting nonsingularity of $A$. The easier argument is by determinants: $|A|=| A_{11}|\cdot| A_{22}|$. Left hand side is nonzero if and only if both factor on the right hand side are nonzero.)
Thus, consider the matrix $B=\begin{bmatrix}A_{11}^{-1}& -A_{11}^{-1}A_{12}A_{22}^{-1}\\0& A_{22}^{-1}\end{bmatrix}$.
Multiplying:
$AB=\begin{bmatrix}A_{11}& A_{12}\\0&A_{22}\end{bmatrix}\cdot\begin{bmatrix}A_{11}^{-1}& -A_{11}^{-1}A_{12}A_{22}^{-1}\\0& A_{22}^{-1}\end{bmatrix}\\
=\begin{bmatrix}I_{p}& -A_{11}\cdot A_{11}^{-1}A_{12}A_{22}^{-1}+A_{12}A_{22}^{-1}\\0&I_q\end{bmatrix}=I.$
Hence, $B$ is the inverse of $A$.