From your description, I believe we are talking about the "Universal Switch" feature.
"A universal switch lets you designate certain touches or gestures to control specific actions on your phone..."
I had get in confidence with this unknown feature when my Samsung S6 was stuck, thus unresponsive, on this mysterious interface control. I finally got out of that hell by a "Power+Vol UP+Vol Down+Home" restart.
more on http://www.samsung.com/uk/accessibility/product_galaxy_universal_switch.html