Tiling with Squares and Packing Dominos in Polynomial Time