Need help with program!

For the program I am currently writing I have separated the screen into 12 different sections, each section being 256x256 pixels. For this program to work I need a way to figure out to determine where on the X axis and where on the Y axis the user has touched (to determine which square has been touched). Also, I need to be able to have multiple touches recognized in the program. Right now, I can’t figure out a way to do this, and I was wondering if someone could help me.

If you have any questions that would help you understand the situation better feel free to ask.

Thanks!

Here is an example of displaying the x,y value for multiple touches. Just drag multiple fingers around the screen.


supportedOrientations(PORTRAIT_ANY)
displayMode(FULLSCREEN)

function setup()
    tab={}  -- table of touches
end

function draw()
    background(40,40,50)
    fill(255)
    for a,b in pairs(tab) do
        str=string.format("x = %d     y = %d",b.x,b.y)
        text(str,WIDTH/2,1000-50*a)    -- display x,y values
    end
end

function touched(t)
    if t.state==BEGAN then
        table.insert(tab,vec3(t.x,t.y,t.id))    -- put x,y,id in table
    elseif t.state==MOVING then
        for a,b in pairs(tab) do
            if t.id==b.z then    -- id matches entry in table
                tab[a]=vec3(t.x,t.y,t.id)  -- update x,y,id in table
                return            
            end
        end
    elseif t.state==ENDED then
        for a,b in pairs(tab) do
            if t.id==b.z then   -- id matches entry in table
                table.remove(tab,a)    -- remove entry from table
            end
        end
    end
end