adding function to reshape a vector into a square