Cropping tool mat-function

Small function that can help with optimization when using masks.