What is the best approach for writing a program to identify objects in a picture then crop them a specific way?
Depending on kind and amount of data you posess, there are few approaches that you might consider.


Marking target objects on dataset and training CNN that returns coordinates of target object. In this case, remember that it is usually faster when training data ROIs have their coordinates relative to image size.
Use some kind of focus mechanism, like spatial transformer network:


https://arxiv.org/abs/1506.02025


This kind of network component is able to learn image transformation (including crop) that maximazes target metric for main classifier. This tutorial on pytorch:


https://pytorch.org/tutorials/intermediate/spatial_transformer_tutorial.html


shows some nice visualizations of STN results. Good thing about this kind of network is that, given enough data, it might learn proper transformation from image classification data (photo -> class). One does not need to explicitly mark target objects on image!
Object detection networks, like YOLO, Faster-RCNN. There are many tutorials on that matter, eg:


https://www.datacamp.com/community/tutorials/object-detection-guide

Saliency extraction. Simple idea is to generate heatmap showing what parts of input image activates classifier the most. I guess you could try calculate bounding box basing on such heatmap. Example research paper:


https://arxiv.org/abs/1805.08249



Points 1 and 2 are probably easies to implement, so I would start with them.