generalised to a 2x2 matrix and any filename