A square and a rectangle have the same area. The length of the rectangle is three inches more than the side of the square. The width of the rectangle is two inches less than the side of the square. Algebraically, find the dimensions of both the square and the rectangle.