The source 1D array representing the full 2D mask.
The width of the original source mask (stride).
The starting horizontal coordinate.
The starting vertical coordinate.
The width of the region to extract.
The height of the region to extract.
A new Uint8Array containing the extracted region.
Extracts a rectangular region from a 1D Uint8Array mask. This utility calculates the necessary offsets based on the
maskWidthto slice out a specific area.