/// <summary>
        /// Transforms the rectangle using specified matrix.
        /// </summary>
        /// <param name="matrix">The matrix.</param>
        /// <returns>
        /// A new shape with the matrix applied to it.
        /// </returns>
        public IPath Transform(Matrix3x2 matrix)
        {
            if (IsDisposed)
            {
                throw new ObjectDisposedException(nameof(RectangularPolygon));
            }

            if (matrix.IsIdentity)
            {
                return(this);
            }

            // rectangles may be rotated and skewed which means they will then nedd representing by a polygon
            // rent _points into secondary list as disposing the linear segment recycles _points
            var secondary = PrimitiveListPools.PointF.Rent(this._points);

            using (var linear = new LinearLineSegment(secondary))
                return(new Polygon(linear.Transform(matrix)));
        }