The optimal solution then is to get an infinite number of people on the internet to solve it for you for free!
Its an np-hard problem! Definitiv! And this is exactly what i thought!
Yes, there are several papers on the subject. I found a few by searching "rectangle packing algorithm."
Although I didn't read it until after I had created my solutions, I found Andrea Lodi's paper [1] very interesting. It wasn't quite the approach I used, but it's a pretty thorough explanation of the problem and possible solutions.