Fix bugs in combine_small_quad()
Optimize rectangular shape creation.