I have experience working with graphics in Java and have worked on similar projects that require detection of overlapping images, as well as rotating and positioning images on top of each other.
I can provide a Java program that would run on any platform. The program would allow you to select as many files as you want, and would arrange them in the best way to maximize space on the final resulting image.
I think there are additional rules or features that will have to be taken into account. You may select too many files and they would not fit no matter how you arrange them.
If you print a lot, you may want the program to generate multiple outputs at a time, based on many files. For example you could pick 100 files to generate 10 different results at a time.
I would need to know more information before starting, especially the type of output the program should produce, a JPG or vector type.