The answer in this link would work for your use case as well and is used in a Xamarin application: https://stackoverflow.com/questions/60828712/crop-image-with-multiple-x-and-y-points-c-sharp/64861791#64861791
private RasterImage DetectAndDeskew(RasterImage image)
DetectDocumentCommand detectDocumentCommand = new DetectDocumentCommand();
Android Studio has a zipped version but it is not portable by default.
I recently made a self-answered post at stackoverflow.com on how to make it portable by hand with few console tricks to use. The post has a room for further improvements but should be enough to start if not satisfies fully. Give comments if you use the way I described and find problems.