Minecraft Teleport Using Rectangular Radius

How would you teleport players using a rectangle radius. When I use the radius command, it selects a grid that's a perfect cube like (/@e{x=1,y=2,z=3,r=6}) witch will select a 6x6x6 grid around the coordinates 1,2,3 when I need the grid to be something like 6x10x5, so it's not a perfect cube.


Solution 1:

Use the dx, dy and dz arguments. They expand the "selection" box starting from the x, y and z arguments.
For example, a 6x10x5 box starting at [1 2 3] would be @e[x=1,y=2,z=3,dx=6,dy=10,dz=5].

Please note however that the x, y and z arguments points to a corner of the box. To get it centered, a bit of math will be required.

You can find more info about target selectors on the Minecraft Wiki.