Store distance from margin in 1x1 Mat