tile calculation