Yes there is. You can try the "scan documents and text" feature within the camera. It's a setting that looks for square objects, then when you press a button in the bottom right, auto crops and edits the image. Unsure how well it works on photos but it works on the box of paracetamol that's next to me.
For a more known solution, google make an app specially for this purpose.
https://play.google.com/store/apps/details?id=com.google.android.apps.photos.scanner