I have a specific problem and initially I am interested on suggestions for which branch(es) of mathematics may be worth learning to solve my problem.

Problem a general solution for the following.

Given:- x and y (the width and height of an area in pixels - of part of a screen area)

t = a number of tiles (each of which will have the same width and height ratio) to split the screen area are into.

Find:-The number of rows and columns of tiles that make the best use (best fit) for the given number of tiles into the given screen space.

And presumably a direct consequence of determining the above, the x and y dimensions of the each tile while maintaining the width height ratio (obviously the x and y ratio will vary related to the screen space and the number of tiles).

So, which branch(es) of Mathematics will help me solve this problem? Of course if someone already has a specific solution this would be very much appreciated and save me a lot of time learning the maths.

Thank in advance