Factored common Matrix2D file support code.