Write a small Python function validating a rectangular matrix before transposing it.