Rewrite split to be a more general retile prog