rotate method
Implementation
Rect rotate(double radians, {Offset? origin}) {
final Matrix4 matrix = Matrix4.identity();
// Translate to the origin.
matrix.translate(origin?.dx ?? 0, origin?.dy ?? 0);
// Rotate.
matrix.rotateZ(radians);
// Translate back.
matrix.translate(-(origin?.dx ?? 0), -(origin?.dy ?? 0));
return MatrixUtils.transformRect(matrix, this);
}