These are divination blocks, usually referred to by their name in Taiwanese, buay. You'll find them in every temple, large or small. People ask questions of the gods and read the answers from how the buay fall. They're always used in pairs. Here's a detailed explanation from this source:
"In divination the worshipper usually poses a question, and then phrases an answer, the blocks are held out upon the two palms, raised about to the level of the forehead of a kneeling worshipper, and allowed to drop on the floor. There are two positions in which each block can land: rounded side up or rounded side down. Therefore there are three combinations of positions, both blocks might land flat side down, both might land rounded side down or each might land differently. If the blocks land in the last combination, one up, one down, then this is taken to indicate confirmation of the answer.
"It is believed that when the two blocks land rounded side downward and rock giddily on the floor before coming to rest, the god is amused at the statement put to him, and this position is called 'laughing jiao' but when the flat sides come to rest on the floor, so that the blocks fall and come immediately to an abrupt standstill, then anger is indicated. This position is called 'negative jiao'. The positive fall is called 'sacred jiao'. These interpretations of negative replies are seldom taken very seriously, however, and what is important is to determine what form of a statement the god will confirm as a correct statement of his point of view, rather than to develop an emphatic yes or no to a given question. The question is typically presented in a murmured silent prayer and the blocks dropped. If they indicate an affirmative, they are dropped again. A validly affirmative reply requires three consecutive positive falls, and the occurrence of either negative reply requires the reconstruction of the question and another attempt, or requires that one give up.
"These blocks are used in ordinary consultations with household and temple idols, as well as with ancestors."