Improve compatibility for rectangle type conversion. (#20704)
Closes #20515
### Summary of the issue:
Sometimes we are unsure of the type of the rectangle, and an exception
will be thrown when converting it to the same type.
### Description of user facing changes:
None
### Description of developer facing changes:
This has no practical impact on existing code.
### Description of development approach:
In `locationHelper`, the `RectLTWH.toLTRB` and `RectLTRB.toLTWH` methods
have both been moved to the `_RectMixin` class to improve compatibility.
### Testing strategy:
Unit tests have been added.
### Known issues with pull request:
None