Given an m x n binary matrix `mat`, return a matrix of the same size where each cell holds the distance to the nearest 0, measured in horizontal/vertical steps.