Haxe port of MaxRectsBinPack