You are completely missing the point. If I change the width of a rectangle then the height is unchanged. Your square class breaks that.
As long as you are aware of the LSP violation, feel free to make square a subclass of rect. Change the implementation of setWidth and setHeight to assert(). If you like add a method setWidthAndHeight() which asserts if the result is not a square. Use what you can from the base class.