For a general square matrix m and arbitrary partition of it into conformable parts m={{a,b},{c,d}} (i.e., a and d are square matrices, and b and c have appropriate dimensions),

the formula for the inverse is
m={{a,b},{c,d}}; e = d - c.Inverse[a].b; minv={{Inverse[a] + Inverse[a].b.Inverse[e].c.Inverse[a], -Inverse[a].b.Inverse[e]}, {-Inverse[e].c.Inverse[a], Inverse[e]}}; 
This can be used to define a function that takes a matrix and a partition specification and does the needed type and conformability checks before applying the formula.
The formula can be found in, for example, Review of Matrix Algebra.