One possible approach would be to just reshape the rows of your images and the target into the batch dimension, so that your batches will be batch_size*9.
However, your input would be 1-dimensional afterwards.
Would this be a possibility or would you like to process the input somehow as image data?